<%@ page pageEncoding="utf-8"%> 
<%@page import="com.course.db.*"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>

<%
	request.setAttribute("layout","main.jsp");
	request.setAttribute("page_title","温岭选课系统-课程列表");
	CourseBasic course = (CourseBasic)session.getAttribute("CourseStudentDetail");

	List<Hashtable<String, String>> student_list = (List<Hashtable<String, String>>) session.getAttribute("CourseStudentList");
	Iterator<Hashtable<String, String>> student_it = student_list.iterator();
	System.out.println("size:"+student_list.size());
%>
<style>

</style>

<div style="width:100%; text-align:center;">
 	<p style="border:0;font-size:14px;padding-bottom:0;">
 		 <b>课程《<%=course.getName() %>》选课详情</b>
	</p>
  	<table width="90%"  style="border:1px solid gray;margin-left:5%;" >
      <tbody>
        <tr height="32" bgcolor="#f0f0f0">
		   <td align="center" width="7%">课程编号</td>
		   <td align="center" width="8%">课程类型</td>
		   <td align="center" width="8%">课程名称</td>
		   <td align="center" width="8%">授课老师</td>
           <td align="center" width="10%">上课时间|地点</td>
           <td align="center" width="6%">学分</td>
           <td align="center" width="6%">人数限额<br>(最少/最多)</td>
		   <td align="center" width="6%">已选人数<br>
           <td align="center" width="6%">课程状态</td>
		 </tr>
		 <tr height="25" bgcolor="#ffffff">
		    <td align="center"><%=course.getClassno() %></td>
		    <td align="center"><%=course.getType() %></td>
		    <td align="center"><%=course.getName() %></td>
		    <td align="center"><%=course.getTeachers() %></td>
		    <td align="center"><%=course.getTeach_time() %>|<%=course.getTeach_location() %></td>
		    <td align="center"><%=course.getCredit() %></td>
		    <td align="center"><%=course.getStudents_low() %>/<%=course.getStudents_high() %></td>
		   	<td align="center"><%=course.getNum_of_students() %></td>
		    <td align="center">
			    <% if(course.getCheck_status()==0){%>
					审核中
				<% }else if(course.getCheck_status()==1){ %>
					审核通过
				<%}else if(course.getCheck_status()==2){ %>
					审核不通过
				<%}else if(course.getCheck_status()==3){ %>
					选课中
				<%}else if(course.getCheck_status()==4){ %>
					开课
				<%}else if(course.getCheck_status()==5){ %>
					结束
				<%} %>
		    </td>
		</tr>
        <tr>
           <td colspan="9" align="center" ><br>课程说明<br>&nbsp;</td>
        </tr>
        <tr>
           <td colspan="9" align="center">&nbsp;</td>
        </tr>
        <tr>
           <td colspan="9" align="center"><font>选课学生名单</font>&nbsp;<a href="admin/studentList.jspx?coursename=<%=course.getName()%>&courseId=<%=course.getId() %>">增加学生</a></td>
        </tr>
        <tr>
        	<td colspan="9">
        	<br>
        		<table width="90%"  style="border:1px solid gray;margin-left:5%;" >
			      <tbody>
			        <tr height="32" bgcolor="#f0f0f0">
			        	<td align="center">学号</td>
					    <td align="center">姓名</td>
					    <td align="center">班级</td>
					    <td align="center">操作</td>
			        	<td align="center">学号</td>
					    <td align="center">姓名</td>
					    <td align="center">班级</td>
					    <td align="center">操作</td>
			        	<td align="center">学号</td>
					    <td align="center">姓名</td>
					    <td align="center">班级</td>
					    <td align="center">操作</td>
			        </tr>
			        <%
			            student_it = student_list.iterator();
					    while(student_it.hasNext())
						{
					%>
			        <tr height="32" bgcolor="#ffffff">
			        <%
				        for(int i=0; i<3; i++)
						{
							if(student_it.hasNext()){
								Hashtable<String, String> studentlist_hash  = student_it.next();
			        %>
			        	<td align="center"><%=studentlist_hash.get("no") %></td>
					    <td align="center"><%=studentlist_hash.get("name") %></td>
					    <td align="center"><%=studentlist_hash.get("grade") %> </td>
					    <td align="center"><a href="Admin/deleteChoose.do?courseId=<%=course.getId()%>&studentId=<%=studentlist_hash.get("student_id") %>">删除</a></td>
					 <%}else{ %>
			        	<td align="center"></td>
					    <td align="center"></td>
					    <td align="center"></td>
					    <td align="center"></td>
					    <%}} %>
			        </tr>
			        <%
					}
			        %>
			      </tbody>
			    </table>
			    <br>&nbsp;
        	</td>
        </tr>
      </tbody>
    </table>
</div>
</body>